#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

double average(int* salary, int salarySize)
{
    int MAX = salary[0];
    int MIN = salary[0];
    int sum = 0;

    for (int i = 0; i < salarySize; i++)
    {
        MAX = MAX > salary[i] ? MAX : salary[i];
        MIN = MIN < salary[i] ? MIN : salary[i];
        sum += salary[i];
    }

    return (double)(sum - MAX - MIN) / (salarySize - 2);
}